package cn.qzuie.smart.module.dorm.dal.mysql.energyequipment;

import java.util.*;

import cn.qzuie.smart.framework.common.pojo.PageResult;
import cn.qzuie.smart.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.qzuie.smart.framework.mybatis.core.mapper.BaseMapperX;
import cn.qzuie.smart.module.dorm.dal.dataobject.energyequipment.EnergyEquipmentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.qzuie.smart.module.dorm.controller.admin.energyequipment.vo.*;

/**
 * 能源设备 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface EnergyEquipmentMapper extends BaseMapperX<EnergyEquipmentDO> {

    default PageResult<EnergyEquipmentDO> selectPage(EnergyEquipmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnergyEquipmentDO>()
                .eqIfPresent(EnergyEquipmentDO::getMac, reqVO.getMac())
                .eqIfPresent(EnergyEquipmentDO::getDormitoryId, reqVO.getDormitoryId())
                .eqIfPresent(EnergyEquipmentDO::getType, reqVO.getType())
                .eqIfPresent(EnergyEquipmentDO::getPrice, reqVO.getPrice())
                .eqIfPresent(EnergyEquipmentDO::getGatewayId, reqVO.getGatewayId())
                .eqIfPresent(EnergyEquipmentDO::getIsRemote, reqVO.getIsRemote())
                .betweenIfPresent(EnergyEquipmentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EnergyEquipmentDO::getId));
    }

}